package springboot_rabbitmq.consumer;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Date;

/**
 * @author 帅小伙
 * @date 2022/1/6
 * @description
 */

@Component
@Slf4j
public class ConfirmConsumer {

    public static final String CONFIRM_EXCHANGE_NAME = "confirm.exchange";
    public static final String CONFIRM_QUEUE_NAME = "confirm.queue";
    public static final String CONFIRM_EXCHANGE_QUEUE_KEY = "confirm.key";


    @RabbitListener(queues = CONFIRM_QUEUE_NAME)
    public void receiveD(Message message){
        String msg = new String(message.getBody());
        log.info("当前时间{},收到队列{}的消息:{}",new Date(),CONFIRM_QUEUE_NAME,msg);
    }



}
